import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'
import Test from '../views/Test.vue'
import Course from '../views/Course.vue'
import Ht from '../views/Ht.vue'
import Cs from '../views/Cs.vue'
import Desc from '../views/Desc.vue'
Vue.use(VueRouter)

const routes = [{
    path: '/',
    name: 'Home',
    component: HomeView
  },
  {
    path: '/course',
    component: Course,
    /*
      二级路由
      1.为每一个路由创建一个对应的.vue文件
      2.路由传参
      2.1query

    */
    children: [{
      path: '/html',
      component: Ht,
    }, {
      path: '/css',
      component: Cs,
    }, {
      name: 'desc',
      path: '/desc/:name/:id',
      component: Desc,
      //对象模式
      /* props: {
        id: 6,
        name: 'zhangsan'
      } */
      //布尔模式
      props: true
    }]
  }
]

const router = new VueRouter({
  routes
})

export default router
